<?
class Controller
{
    function Controller()
    {
		global $CONFIG, $ownersid, $sitetree;
		
		// set sub-site params
		$CONFIG["root"] = $GLOBALS["root"];
		$CONFIG["ownername"] = "default";
		$CONFIG["owner"] = 1;
		
		// load site structure
		$sitetree = new SiteTree();
		$CONFIG['page'] = $sitetree->currentpage;
		$CONFIG['params'] = $sitetree->params;
		$CONFIG['pagepath'] = $sitetree->currentpath;
		$CONFIG['pagetitle'] = $sitetree->currentpage['title'];
		$CONFIG['keywords'] = $sitetree->currentpage['keywords'];
		if( ! $CONFIG['page']['maket'] ) $CONFIG['page']['maket'] = $CONFIG['ownername'];
		if($_REQUEST["print"]=="yes") $CONFIG['page']['maket']="print";
		$CONFIG['skin'] = 'site/'.$CONFIG['ownername'];
		$CONFIG['public_dir'] = $GLOBALS['public_dir'];
		}
	
	function Render($echo=true) {
		global $CONFIG;
		
		$dao=Array();
		$dao = array_merge($dao,$CONFIG);
		$content = GetSiteTemplate($CONFIG['page']['maket']);
		$content = TemplaterParse($content, $dao);
		ImagePath($content);
		if($echo) echo $content;
		else return $content;
	}
}
?>